'use strict';
angular.module('mobile_app')
    .run(
        ['$rootScope', '$state', '$stateParams',
            function($rootScope, $state, $stateParams) {
                $rootScope.$state = $state;
                $rootScope.$stateParams = $stateParams;
            }
        ]
    )
    .config(
        ['$stateProvider', '$urlRouterProvider',
            function($stateProvider, $urlRouterProvider) {

                $urlRouterProvider
                    .otherwise('/douxiaoli/mobile_index');
                $stateProvider
                    .state('douxiaoli', {
                        abstract: true,
                        url: '/douxiaoli',
                        templateUrl: 'template/mobile/mobile_app.html'
                    })
                    // 移动端_首页
                    .state('douxiaoli.mobile_index', {
                        url: '/mobile_index',
                        templateUrl: 'template/mobile/mobile_index.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load(['js/controllers/mobile/mobile_index.js']);
                                }
                            ]
                        }
                    })
                    // 移动端_作品
                    .state('douxiaoli.mobile_works', {
                        url: '/mobile_works',
                        templateUrl: 'template/mobile/mobile_works.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function($ocLazyLoad) {
                                    // return $ocLazyLoad.load(['js/controllers/mobile/mobile_works.js']);
                                }
                            ]
                        }
                    })
                    // 移动端_关于
                    .state('douxiaoli.mobile_about', {
                        url: '/mobile_about',
                        templateUrl: 'template/mobile/mobile_about.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function($ocLazyLoad) {
                                    // return $ocLazyLoad.load(['js/controllers/mobile/mobile_about.js']);
                                }
                            ]
                        }
                    })
                    // 移动端_动态
                    .state('douxiaoli.mobile_dynamic', {
                        url: '/mobile_dynamic',
                        templateUrl: 'template/mobile/mobile_dynamic.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function($ocLazyLoad) {
                                    // return $ocLazyLoad.load(['js/controllers/mobile/mobile_dynamic.js']);
                                }
                            ]
                        }
                    })
                    // 移动端_指南
                    .state('douxiaoli.mobile_guide', {
                        url: '/mobile_guide',
                        templateUrl: 'template/mobile/mobile_guide.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function($ocLazyLoad) {
                                    // return $ocLazyLoad.load(['js/controllers/mobile/mobile_guide.js']);
                                }
                            ]
                        }
                    })
                    // 移动端_作品详情
                    .state('douxiaoli.mobile_details_works', {
                        url: '/mobile_details_works',
                        templateUrl: 'template/mobile/mobile_details_works.html',
                        resolve: {
                            deps: ['$ocLazyLoad',
                                function($ocLazyLoad) {
                                    // return $ocLazyLoad.load(['js/controllers/mobile/mobile_details_works.js']);
                                }
                            ]
                        }
                    })
            }
        ]
    );